﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ERP_RORZE_TOOL.Common.ValueObject;
using ERP_RORZE_TOOL.DBAccess;

namespace ERP_RORZE_TOOL.BizLogic
{
	public class BrokenHelper
	{
		private Broken obj;

		#region BrokenHelper(Broken obj)
		public BrokenHelper(Broken obj)
		{
			ValueObject = obj;
		}
		#endregion

		//
		#region ValueObject
		public Broken ValueObject
		{
			get
			{
				return obj;
			}
			set
			{
				obj = value;
			}
		}
		#endregion

		public DataTable GetAll(int range)
		{
            DataTable dt = BrokenDAO.GetAll(range);
			return dt;
		}

		public DataTable GetOne()
		{
			DataTable dt = BrokenDAO.GetOne(ValueObject.ID);
			return dt;
		}

		public void LoadOne()
		{
			ValueObject = BrokenDAO.LoadOne(ValueObject.ID);
		}

		public int Insert()
		{
			int result = BrokenDAO.Insert(ValueObject);
			return result;
		}

		public int Update()
		{
			int result = BrokenDAO.Update(ValueObject);
			return result;
		}

		public int Delete()
		{
			int result = BrokenDAO.Delete(ValueObject);
			return result;
		}
	}
}
